import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * Created with IntelliJ IDEA
 * Description:
 * User:22954
 * Date:2024-07-09
 * Time:22:41
 */
public class MyTomcat {
    public static void main(String[] args) throws IOException {
        ServerSocket serverSocket = new ServerSocket(9999);
        while (!serverSocket.isClosed()) {
            Socket socket = serverSocket.accept();
            OutputStream outputStream = socket.getOutputStream();
            BufferedReader br = new BufferedReader(new FileReader("src/Hello.html"));
            String line;
            while ((line = br.readLine()) != null) {
                outputStream.write(line.getBytes());
                System.out.println(line);
            }
            outputStream.close();
            socket.close();
        }
        serverSocket.close();
    }
}
